package web.adminUI;

import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import web.sharedUI.SessionBean;
import ejb.contentManagement.RoomMgr;
import ejb.dto.RoomDTO;

@ManagedBean
@RequestScoped
public class RoomBean {
	
	public RoomBean() {
		room = new RoomDTO();
	}
	
	@EJB
	private RoomMgr roomMgr; 
	
	@SuppressWarnings("unused")
	private List<RoomDTO> allRooms;

	private int roomId;
	private RoomDTO room;
	
	
	/*
	 * GETTERS & SETTERS
	 */
	
	public List<RoomDTO> getAllRooms() {
		return roomMgr.getAllRoomsDTO();
		//return allNations;
	}

	public void setAllRooms(List<RoomDTO> allRooms) {
		this.allRooms = allRooms;
	}


	public int getRoomId() {
		return roomId;
	}

	public void setRoomId(int roomId) {
		this.roomId = roomId;
		room = roomMgr.getRoomDTO(roomId);
		if(room == null)
			SessionBean.notFound();
	}

	public RoomDTO getRoom() {
		return room;
	}

	public void setRoom(RoomDTO room) {
		this.room = room;
	}

	
}
